1.1. Python
In one glance
- You will: Use uv and the project tasks while keeping runtime, tests, and evaluation dependencies distinct.
- You need: Working knowledge of Python, venv, pip, and imports; install:learner completed.
- Time: about 10 minutes, reference.
What Python knowledge is assumed?
You already know how to create an environment, install packages, import modules, and debug a traceback.
For preparation, use the Python tutorial and virtual environments guide. The course teaches agent development and operations, not Python fundamentals.
How does uv fit your existing workflow?
uv manages the project's environment, interpreter, and locked dependency graph.
| Familiar action | Repository equivalent |
|---|---|
| Create a venv and install dependencies | mise run install:learner |
| Run a Python program in that environment | uv run --project agents/python --locked --no-default-groups python ... |
| Check a learner exercise | mise run lab -- check 2 |
| Run the full reference test suite | mise run test after mise run install |
| Add the evaluation stack | cd agents/python && mise run install:eval |
The manifest declares requires-python = ">=3.13,<3.14". .python-version and the lockfiles select the actual interpreter and dependencies. Avoid installing extra packages into the managed environment with an unrelated pip command.
Which dependencies does the runtime use?
The runtime is separate from developer and evaluation tooling.
dependencies = [
"aiosqlite>=0.22.1,<0.23", # async SQLite driver for ADK sessions and the A2A task store
"google-adk[a2a]>=2.10.0", # locked agent runtime + A2A serving; avoid the unused Spanner `db` extra
"a2a-sdk>=1.1.5", # A2A protocol types + server (Ch. 3.6); 1.x reworked the type surface — kept current with ADK's <2 cap
# Model Context Protocol server (MCPServer) + client (McpToolset), Ch. 3.3. SDK 2.x speaks the
# 2026-07-28 revision and still serves 2025-era clients such as agentgateway. ADK resolves 1.x
# by default, so the course opts in explicitly; the <3 cap mirrors ADK's declared support.
"mcp>=2.2.0,<3",
"openai>=3.19.2", # OSS SDK used by ADK OpenAILlm for direct Ollama or agentgateway
"opentelemetry-exporter-otlp-proto-http>=1.42.0,<=1.42.1", # match ADK's OTel cap; export to Collector/MLflow
"pydantic-settings>=2.14.2",
"presidio-analyzer==2.2.364", # paired release; 2.2.363 caps cryptography below the security floor
"presidio-anonymizer==2.2.364", # PII redaction paired exactly with the analyzer
"spacy>=3.8,<3.9", # Presidio's NLP engine; pinned to match the en_core_web_sm model below
"en-core-web-sm", # small English spaCy model for Presidio (URL-pinned in [tool.uv.sources])
"tldextract>=5.3.1,<6", # offline email recognition uses its bundled public-suffix snapshot directly
"cryptography>=50.0.0,<51", # security floor for PYSEC-2026-3552/3553/3554
"sqlite-vec>=0.1.6",
"sqlalchemy[asyncio]>=2.0.51,<2.1", # persistent SQLite sessions/tasks without cloud database adapters
]
The full reference includes privacy, persistence, and protocol libraries that the first small agent does not exercise yet. install:learner excludes the development group; mise run install adds the complete offline test tooling. The MLflow server and heavier evaluation dependencies arrive later.
When are credentials loaded?
Only explicit live or configuration commands load the repository-root .env.
mise run lab -- run N loads it before launching ADK Web. The reference's run, web, a2a, and evaluation tasks use the mise dotenv loader with redaction. lab check, check:labs, installation, and offline tests do not load dotenv.
Shell environment variables still exist independently of dotenv. Tests remove ambient provider settings before importing the reference and substitute deterministic model doubles. Never use a real API key as a test fixture.
The reference container currently uses 3.13.15-slim-trixie; the Dockerfile owns this compatibility pin and the platform chapter owns container work.
What proves this page worked?
mise run lab -- list
mise run check:labs
You are done when:
- You can identify the learner runtime and the separate development/evaluation groups.
- You know which commands make model calls and which are offline.
- You can list the eight exercises and distinguish checks of worked solutions from checks of your own code.
Continue to 1.4. Providers to configure Gemini or the optional local alternative.